//import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
//import javax.swing.*;
//import java.util.Arrays;
//import java.util.Date;
//import java.util.List;
//import java.util.Scanner;
//public class Animal1{
//    public static void main(String[] args) {
//        Dog dog[]={new Dog("牧羊犬","W",2,50),
//                new Dog(),
//                new Dog("泰迪","M",3,20),
//                new Dog("藏獒","W",1,30),new Dog("金毛","M",1,15)};
//        Arrays.sort(dog);
//        for(Dog dog1:dog){
//            System.out.println(dog1.getName()+" "+dog1.getSex()+" "+dog1.getAge()+" "+dog1.getWeight());
//        }
//    }
//}
//class Dog1 implements Comparable{
//    private int age;
//    private String name;
//    private String sex;
//    private int weight;
//    @Override
//    ///排序规则：M排在W前面；age小的排在前面；weight小的排在前面
//    public int compareTo(Object o) {
//        Dog that=(Dog)o;
//        if(this.sex.compareTo(that.sex)==0){
//            if(this.age==that.age){
//                if(this.weight==that.weight){
//                    return 0;
//                }
//                return this.weight-that.weight;
//            }
//            return this.age-that.age;
//        }
//        return this.sex.compareTo(that.sex);
//    }
//    public Dog(){
//        this.name="拉布拉多犬";
//        this.sex="M";
//    }
//    public Dog(String name, String sex,int age, int weight) {
//        this.age = age;
//        this.name = name;
//        this.sex = sex;
//        this.weight = weight;
//    }
//    public int getAge() {
//        return age;
//    }
//
//    public String getName() {
//        return name;
//    }
//
//    public String getSex() {
//        return sex;
//    }
//
//    public int getWeight() {
//        return weight;
//    }
//
//}